//************************************************************************
//     dfregex.h
//     2009 © DigiFi Limited
//
//     Generic definition of what we want out of RegEx
//     
//
//************************************************************************

#ifndef DFREGEX_HEADER
#define DFREGEX_HEADER

#include "dferrors.h"
#include "dftypes.h"

// #define DF_DEBUG 0

typedef struct {
	unsigned int start;
	unsigned int length;
	
	char *value;
} dfrx_subexpression;

typedef struct {
	unsigned int start;
	unsigned int length;
	
	char *value;
	
	unsigned int num_subexps;
	dfrx_subexpression* subexps;
} dfrx_result;



int dfregex_init(void);


dfrx_result* dfregex_match(char *string, char *regex_name, df_commandtype group);
dfrx_result* dfregex_matches(char *string, char *regex_name, df_commandtype group);

void dfregex_freeresult(dfrx_result* tofree);



void dfregex_free(void);

char* dfregex_getlasterror(void);

void dfregex_test(void);

void dfregex_dump(void);

void dfregex_dumprx(dfrx_result *rx);


#endif